fix(@angular/ssr): patch Headers.forEach in cloneRequestAndPatchHeaders#32834
fix(@angular/ssr): patch Headers.forEach in cloneRequestAndPatchHeaders#32834alan-agius4 merged 1 commit intoangular:mainfrom
Conversation
This commit updates the cloneRequestAndPatchHeaders function to patch the Headers.forEach method. This ensures that host headers are validated when the application iterates over request headers using forEach, preventing potential host header injection attacks during header iteration. A unit test has been added to validation_spec.ts to verify that forEach correctly triggers validation and throws an error for disallowed hosts.
There was a problem hiding this comment.
Code Review
This pull request enhances header validation within the cloneRequestAndPatchHeaders utility by patching the forEach method of the Headers object. This ensures that validateHeader is called for each header when forEach is used, preventing invalid headers from being processed. A new test case has been added to specifically verify this behavior, confirming that iterating over headers with forEach triggers the validation and correctly handles disallowed header values. There are no review comments to address.
|
Hi @alan-agius4 , I have a question regarding the real-world impact of this vulnerability. From my understanding, this bug bypasses the However, I would assume developers typically only use `` `` Given that, would a developer actually have any reason to try and manually pull the |
|
@VenkatKwest, in general I would not expect the |
This commit updates the cloneRequestAndPatchHeaders function to patch the Headers.forEach method. This ensures that host headers are validated when the application iterates over request headers using forEach, preventing potential host header injection attacks during header iteration.
A unit test has been added to validation_spec.ts to verify that forEach correctly triggers validation and throws an error for disallowed hosts.